import java.util.Scanner;

public class a005_Eva的回家作業 {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int m; //測資組數
		int n1, n2, n3, n4; //前4個數
		int n5; //推算出來的第5數
		int d; //公差
		
		while(input.hasNext()) {
			m = input.nextInt();
			
			for(int i = 0; i < m; i++) {
				input.nextLine();
				
				n1 = input.nextInt();
				n2 = input.nextInt();
				n3 = input.nextInt();
				n4 = input.nextInt();
				
				d = n4 - n3;
				if(n1 + d == n2 && n2 + d == n3 && n3 + d == n4)
					System.out.println(n1 + " " + n2 + " " + n3 + " " + n4 +" " + (n4 + d));
				else {
					d = n4 / n3;
					System.out.println(n1 + " " + n2 + " " + n3 + " " + n4 +" " + (n4 * d));
				}
			}
		}
	}
	
}